<script setup lang="ts">
import { useRouter } from 'vue-router'

// 相当于 this.$router
const router = useRouter()
const loginBtn = () => {
  alert('登录成功，跳转到主页')
  router.push('/home')
}
</script>

<template>
  <h2>Login 登录页</h2>
  <button @click="loginBtn">登录按钮</button>
  <button @click="router.push('/home')">直接跳主页</button>
</template>
